package com.davidk.survey.server;

import javax.servlet.http.HttpServletRequest;

public class DataRequest {
	String operationType;

	String startRow;

	String endRow;

	String textMatchStyle;

	String componentId;

	String dataSource;

	public String getOperationType() {
		return operationType;
	}

	public void setOperationType(String operationType) {
		this.operationType = operationType;
	}

	public String getStartRow() {
		return startRow;
	}

	public void setStartRow(String startRow) {
		this.startRow = startRow;
	}

	public String getEndRow() {
		return endRow;
	}

	public void setEndRow(String endRow) {
		this.endRow = endRow;
	}

	public String getTextMatchStyle() {
		return textMatchStyle;
	}

	public void setTextMatchStyle(String textMatchStyle) {
		this.textMatchStyle = textMatchStyle;
	}

	public String getComponentId() {
		return componentId;
	}

	public void setComponentId(String componentId) {
		this.componentId = componentId;
	}

	public String getDataSource() {
		return dataSource;
	}

	public void setDataSource(String dataSource) {
		this.dataSource = dataSource;
	}

	public static DataRequest from(HttpServletRequest request) {
		DataRequest ret = new DataRequest();
		ret.operationType = request.getParameter("_operationType");
		ret.startRow = request.getParameter("_startRow");
		ret.endRow = request.getParameter("_endRow");
		ret.textMatchStyle = request.getParameter("_textMatchStyle"); // values {exact}
		ret.componentId = request.getParameter("_componentId");
		ret.dataSource = request.getParameter("_dataSource");
		return ret;
	}
}
